<!-- 主界面 -->
<div class="main">
	
	<!-- 工具栏 -->
	<div class="toolbar">
		<button open="{area:'600px', offset:'139px'}" url="/admin/friendlink/add" class="btn btn-success btn-sm mr-1">
			<i class="fa fa-plus mr-1"></i>创建
		</button>
	</div>
	
	<!-- 表格容器 -->
	<div id="table-box" class="table-box">
		
		<table class="table table-hover ">
			
			<thead>
				<tr>
					<th>ID</th>
					<th>标题</th>
					<th width="12%">图片</th>
					<th>链接</th>
					<th>打开方式</th>
					<th>权重</th>
					<th>最近操作时间</th>
					<th class="operation">操作</th>
				</tr>
			</thead>
			
			<tbody class="slide-box">
			#for (x : links)
				<tr>
					<td>#(x.id)</td>
					<td>#(x.title)</td>
					<td class="image-item"><img src="#(x.img)" class="img-fluid"></img></td>
					<td>#(x.link)</td>
					<td>#if(x.target=='_blank') 新窗口 #else 当前页 #end</td>
					<td>#(x.weight)</td>
					<td>#date(x.updated)</td>
					<td class="operation">
						<a open="{area:'600px', offset:'139px'}" url="/admin/friendlink/edit?id=#(x.id)">修改</a> |
						#role("超级管理员")
						### 这里用 url 代替 href 是为了防止意外删除数据
						<a confirm="确定删除 #escape(x.title) ？" ok-remove="tr" url="/admin/friendlink/delete?id=#(x.id)">删除</a>
						#end
					</td>
				</tr>
			#end
			</tbody>
			
		</table>
	</div>
</div>
<script>
	/**
	 * 点击图片显示大图
	 */
	layer.photos({
		photos: '.slide-box',
		shade: 0.5,
		// closeBtn: 2,
		offset: '50px',
		anim: 5
	});
</script>



